import { z } from "zod";

export const R_PASSWORD = {
  MIN_LENGTH: 8,
  MAX_LENGTH: 24,
  PATTERN: /^[a-zA-Z0-9~`!@#$%^&*()_+-=\[\]{}:;'",.<>/?|\\]+$/,
};

// prettier-ignore
export const PASSWORD_ZOD = z.string()
  .min(R_PASSWORD.MIN_LENGTH, { message: `密码至少应包含${R_PASSWORD.MIN_LENGTH}个字符。` })
  .max(R_PASSWORD.MAX_LENGTH, { message: `密码最多可包含${R_PASSWORD.MAX_LENGTH}个字符。`})
  .regex(R_PASSWORD.PATTERN, {message:'密码应由数字、大小写字母、键盘区特殊字符组成，不包含空格'});
